package com.example.backend.mapper;


import com.example.backend.entity.Dishes;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.ArrayList;

@Repository
public interface DishesMapper {
    @Delete("delete from dishes where id = #{id}")
    int deleteDishesById(Serializable id);
    @Insert("insert into dishes(name,shop_id,price,state,picture,dishes_class) values(#{name},#{shop_id},#{price},#{state},#{picture},#{dishes_class})")
    int addDishes(Dishes dishes);
    @Select("select * from dishes where id = #{id}")
    Dishes selectDishesById(Serializable id);
    @UpdateProvider(type = DishesMapperProvider.class, method = "getUpdateDishesSql")
    int updateDishes(Dishes dishes);
    @SelectProvider(type = DishesMapperProvider.class, method = "getSelectDishesSql")
    ArrayList<Dishes> selectDishes(Dishes  dishes);
    @Select("select id,name,shop_id,price,state,picture,dishes_class from dishes where shop_id = #{shop_id}")
    ArrayList<Dishes> selectDishesByShopId(String shop_id);



}
